package org.kotboot.ctrl

import org.kotboot.cons.ConsJwt
import org.kotboot.module.R
import org.kotboot.service.SignServ
import org.slf4j.LoggerFactory
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RequestMethod
import org.springframework.web.bind.annotation.RestController
import javax.annotation.Resource

@RestController
@RequestMapping(value = "/sign", method = arrayOf(RequestMethod.POST))
class SignCtrl(
        @Resource  var signServ: SignServ,
        @Autowired val consJwt: ConsJwt
) : BaseCtrl() {

    val LOG = LoggerFactory.getLogger(SignCtrl::class.java)



    /**
     * 登录
     * @return
     */
    @RequestMapping("/signin")
    fun signin(): R<*> {
        val params = getParams()
        return signServ.signin(params)
    }


    /**
     * 注册
     * @return
     */
    @RequestMapping("/signup")
    fun signup(): R<*> {
        val params = getParams()
        return signServ.signup(params)
    }


    /**
     * 获取 短信验证码
     * @return
     */
    @RequestMapping("/smsCode")
    fun smsCode(): R<*> {
        val params = getParams()
        return signServ.smsCode(params)
    }

}